import request from '@/utils/request.js'
// 将所有的针对user的请求，都封装到一个对象中
const userApi = {
    page(conditions) {
        return request.get('/user/selectByPage', {params: conditions})
    },
    list(conditions) {
        return request.get('/user/list', {params: conditions});
    },
    deleteById(id) {
        return request.delete( `/user/deleteById/${id}`)
    },
    deleteAll(ids) {
        return request.delete( `/user/deleteAll/${ids}`)
    },
    add(user) {
        //user以JSON形式传递到后台，后端使用@RequestBody接收
        return request.post('/user/add', user)
    },
    selectById(id) {
        return request.get(`/user/selectById/${id}`)
    },
    update(user) {
        return request.put('/user/update', user)
    }
}

export default userApi